package com.application.meizhi.ui.fragment.douban;

import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.application.meizhi.R;
import com.application.meizhi.adapter.ViewPagerAdapter;
import com.application.meizhi.persenter.douban.DouBanViewPagerPresenter;
import com.application.meizhi.ui.fragment.BaseFragment;
import com.application.meizhi.ui.iView.douban.IDouBanViewPagerView;
import com.ogaclejapan.smarttablayout.SmartTabLayout;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import butterknife.BindView;

/**
 * Created by gskl on 16/10/12.
 */

public class DouBanViewPagerFragment extends BaseFragment<DouBanViewPagerPresenter> implements IDouBanViewPagerView {

    @BindView(R.id.viewpagertab)
    SmartTabLayout mTabLayout;

    @BindView(R.id.viewpager)
    ViewPager mViewPager;

    private ViewPagerAdapter mAdapter;
   /* <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=haixiuzu">请不要害羞</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=kaopulove">最靠谱的恋爱组</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=510760">大胸妹 </a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=407518">大长腿</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=516876">好胸妹</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=503950">靠谱的恋爱</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=446091">满满一碗萝莉大叔组</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=nanpengyou">有男朋友</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=542175">任性</a>
   <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=515085">不正经女青年</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=face2face">头像即本人</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=294735">谈一星期恋爱</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=481977">爆照不问出处</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=godgoddess">赐你男神女神小组</a>
    <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=496295">暴露狂请别害羞【北京】</a>
   <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=416079">叔组</a>
   <a href="http://www.dbmeinv.com/dbgroup/current.htm?gid=rouniu">肉妞粉丝团</a>*/
    private List<String> titles = Arrays.asList("请不要害羞", "最靠谱的恋爱组", "大胸妹", "大长腿", "好胸妹", "靠谱的恋爱",
            "满满一碗萝莉大叔组", "有男朋友", "任性", "不正经女青年", "头像即本人", "谈一星期恋爱", "爆照不问出处",
            "赐你男神女神小组", "暴露狂请别害羞【北京】","叔组","肉妞粉丝团");
    private List<Fragment> fragments;

    @Override
    public void initView() {

        initFragment();
        mAdapter = new ViewPagerAdapter(getFragmentManager(), getActivity(), fragments, titles);
        mViewPager.setAdapter(mAdapter);
        mViewPager.setOffscreenPageLimit(fragments.size());
        mTabLayout.setViewPager(mViewPager);
    }

    private void initFragment() {
        fragments = new ArrayList<>();
        fragments.add(DouBanSingleFragment.newInstance("请不要害羞", "haixiuzu"));
        fragments.add(DouBanSingleFragment.newInstance("最靠谱的恋爱组", "kaopulove"));
        fragments.add(DouBanSingleFragment.newInstance("大胸妹", "510760"));
        fragments.add(DouBanSingleFragment.newInstance("大长腿", "407518"));
        fragments.add(DouBanSingleFragment.newInstance("好胸妹", "516876"));
        fragments.add(DouBanSingleFragment.newInstance("靠谱的恋爱", "503950"));
        fragments.add(DouBanSingleFragment.newInstance("满满一碗萝莉大叔组", "446091"));
        fragments.add(DouBanSingleFragment.newInstance("有男朋友", "nanpengyou"));
        fragments.add(DouBanSingleFragment.newInstance("任性", "542175"));
        fragments.add(DouBanSingleFragment.newInstance("不正经女青年", "515085"));
        fragments.add(DouBanSingleFragment.newInstance("头像即本人", "face2face"));
        fragments.add(DouBanSingleFragment.newInstance("谈一星期恋爱", "294735"));
        fragments.add(DouBanSingleFragment.newInstance("爆照不问出处", "481977"));
        fragments.add(DouBanSingleFragment.newInstance("赐你男神女神小组", "godgoddess"));
        fragments.add(DouBanSingleFragment.newInstance("暴露狂请别害羞【北京】", "496295"));
        fragments.add(DouBanSingleFragment.newInstance("叔组", "416079"));
        fragments.add(DouBanSingleFragment.newInstance("肉妞粉丝团", "rouniu"));
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_view_pager;
    }

    @Override
    protected void initPresenter() {
        presenter = new DouBanViewPagerPresenter(getActivity(), this);
        presenter.init();
    }
}
